home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BigMax 17
/
BigMax nº 17.iso
/
APLICAT
/
PCM105CD
/
SECURE
/
DATA.Z
/
native.h
< prev
next >
Wrap
C/C++ Source or Header
|
1996-12-29
|
12KB
|
334 lines
// (C) Copyright 1996, Microsoft Corporation and it suppliers.
//----------------------------------------------------------------------------
// Public header for facilities provided by MSJava.dll
//----------------------------------------------------------------------------
#ifndef _NATIVE_
#define _NATIVE_
#ifdef __cplusplus
extern "C" {
#endif
//----------------------------------------------------------------------------
// Since handles have gone away, this is no op. The unhands() in this file
// a redundant but useful for clarity.
// Note: You can not just unhand an array to get at it's data, you must now
// use unhand(x)->body.
//----------------------------------------------------------------------------
#define unhand(phobj) (phobj)
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
#define JAVAPKG "java/lang/"
//----------------------------------------------------------------------------
// Standard Java declarations for built in types.
//----------------------------------------------------------------------------
typedef long OBJECT;
typedef OBJECT Classjava_lang_Object;
typedef OBJECT Hjava_lang_Object;
typedef OBJECT ClassObject;
typedef Hjava_lang_Object JHandle;
typedef Hjava_lang_Object HObject;
typedef unsigned short unicode;
typedef long int32_t;
typedef __int64 int64_t;
typedef int BOOL;
typedef void *PVOID;
typedef unsigned long DWORD;
#ifndef _SIZE_T_DEFINED
#define _SIZE_T_DEFINED
typedef unsigned int size_t;
#endif
#ifndef VOID
#define VOID void
#endif
#ifndef _BOOL_T_DEFINED
#define _BOOL_T_DEFINED
typedef BOOL bool_t;
#endif
//----------------------------------------------------------------------------
// Use to get the length of an array an HObject.
//----------------------------------------------------------------------------
#define obj_length(hobj) (((ArrayOfSomething*)unhand(hobj))->length)
//----------------------------------------------------------------------------
// Garbage Collection.
//----------------------------------------------------------------------------
typedef struct {
DWORD reserved[6];
} GCFrame;
void __cdecl GCFramePush(PVOID pGCFrame, PVOID pObjects,
DWORD cbObjectStructSize);
void __cdecl GCFramePop(PVOID pGCFrame);
HObject** __cdecl GCGetPtr(HObject *phobj);
void __cdecl GCFreePtr(HObject **pphobj);
#define GCGetWeakPtr GCGetPtr
#define GCFreeWeakPtr GCFreePtr
int __cdecl GCEnable();
int __cdecl GCDisable();
int __cdecl GCDisableCount();
int __cdecl GCEnableCompletely();
void __cdecl GCDisableMultiple(int cDisable);
//----------------------------------------------------------------------------
// "Built-in" object structures...
// These include helper macro's to get at array data.
//----------------------------------------------------------------------------
#pragma pack(push,1)
typedef struct Classjava_lang_String {
int32_t MSReserved;
struct ClassArrayOfChar *value;
long offset;
long count;
} Classjava_lang_String;
#define Hjava_lang_String Classjava_lang_String
typedef Hjava_lang_String HString;
typedef struct ClassArrayOfByte
{
int32_t MSReserved;
unsigned long length;
char body[1];
} ClassArrayOfByte;
#define HArrayOfByte ClassArrayOfByte
#define ArrayOfByte ClassArrayOfByte
typedef struct ClassArrayOfChar
{
int32_t MSReserved;
unsigned long length;
unsigned short body[1];
} ClassArrayOfChar;
#define HArrayOfChar ClassArrayOfChar
#define ArrayOfChar ClassArrayOfChar
typedef struct ClassArrayOfShort
{
int32_t MSReserved;
unsigned long length;
short body[1];
} ClassArrayOfShort;
#define HArrayOfShort ClassArrayOfShort
#define ArrayOfShort ClassArrayOfShort
typedef struct ClassArrayOfInt
{
int32_t MSReserved;
unsigned long length;
long body[1];
} ClassArrayOfInt;
#define HArrayOfInt ClassArrayOfInt
#define ArrayOfInt ClassArrayOfInt
typedef struct ClassArrayOfLong
{
int32_t MSReserved;
unsigned long length;
__int64 body[1];
} ClassArrayOfLong;
#define HArrayOfLong ClassArrayOfLong
#define ArrayOfLong ClassArrayOfLong
typedef struct ClassArrayOfFloat
{
int32_t MSReserved;
unsigned long length;
float body[1];
} ClassArrayOfFloat;
#define HArrayOfFloat ClassArrayOfFloat
#define ArrayOfFloat ClassArrayOfFloat
typedef struct ClassArrayOfDouble
{
int32_t MSReserved;
unsigned long length;
double body[1];
} ClassArrayOfDouble;
#define HArrayOfDouble ClassArrayOfDouble
#define ArrayOfDouble ClassArrayOfDouble
typedef struct ClassArrayOfObject
{
int32_t MSReserved;
unsigned long length;
HObject *body[1];
} ClassArrayOfObject;
#define HArrayOfObject ClassArrayOfObject
#define ArrayOfObject ClassArrayOfObject
typedef struct ClassArrayOfString
{
int32_t MSReserved;
unsigned long length;
HString *(body[1]);
} ClassArrayOfString;
#define HArrayOfString ClassArrayOfString
#define ArrayOfString ClassArrayOfString
typedef struct ClassArrayOfArray
{
int32_t MSReserved;
unsigned long length;
JHandle *(body[1]);
} ClassArrayOfArray;
#define HArrayOfArray ClassArrayOfArray
#define ArrayOfArray ClassArrayOfArray
typedef struct
{
int32_t MSReserved;
unsigned long length;
} ArrayOfSomething;
#pragma pack(pop)
//----------------------------------------------------------------------------
// We automatically track the execution environment so there's no EE() call
// needed anymore, just pass NULL if an API needs one.
//----------------------------------------------------------------------------
#define EE() NULL
typedef void ExecEnv;
//----------------------------------------------------------------------------
// Exception handling stuff...
//----------------------------------------------------------------------------
void __cdecl SignalError(struct execenv *ee, char *ename, char *DetailMessage);
bool_t __cdecl exceptionOccurred(ExecEnv *ee);
void __cdecl exceptionDescribe(ExecEnv *ee);
void __cdecl exceptionClear(ExecEnv *ee);
void __cdecl SignalErrorPrintf( char *ename, char *pszFormat, ...);
//----------------------------------------------------------------------------
// Standard exec functions...
//----------------------------------------------------------------------------
typedef PVOID ClassClass;
HObject* __cdecl execute_java_constructor(ExecEnv *ee, char *classname,
ClassClass *cb, char *signature, ...);
long __cdecl execute_java_dynamic_method(ExecEnv *ee, HObject *obj, char
*method_name, char *signature, ...);
//----------------------------------------------------------------------------
// NB The resolve flag is ignored, classes found with this api will always
// be resolved.
//----------------------------------------------------------------------------
ClassClass* __cdecl FindClass(ExecEnv *ee, char *classname, bool_t resolve);
long __cdecl execute_java_static_method(ExecEnv *ee, ClassClass *cb,
char *method_name, char *signature, ...);
//----------------------------------------------------------------------------
// Helper function that returns a methodblock.
//----------------------------------------------------------------------------
struct methodblock* __cdecl get_methodblock(HObject *pjobj, char *method_name,
char *signature);
//----------------------------------------------------------------------------
// If you pass in a methodblock from get_methodblock the method name and
// sig are ignored and so it's faster than a regular execute.
//----------------------------------------------------------------------------
long __cdecl do_execute_java_method(ExecEnv *ee, void *obj, char *method_name,
char *signature, struct methodblock *mb, bool_t isStaticCall, ...);
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
BOOL __cdecl isInstanceOf(JHandle *phobj, char *classname);
//----------------------------------------------------------------------------
#define T_TMASK 034
#define T_LMASK 003
#define T_MKTYPE( t, l ) ( ( (t)&T_TMASK ) | ( (l)&T_LMASK) )
#define T_CLASS 2
#define T_FLOATING 4
#define T_CHAR 5
#define T_INTEGER 010
#define T_BOOLEAN 4
#define T_FLOAT T_MKTYPE(T_FLOATING,2)
#define T_DOUBLE T_MKTYPE(T_FLOATING,3)
#define T_BYTE T_MKTYPE(T_INTEGER,0)
#define T_SHORT T_MKTYPE(T_INTEGER,1)
#define T_INT T_MKTYPE(T_INTEGER,2)
#define T_LONG T_MKTYPE(T_INTEGER,3)
//----------------------------------------------------------------------------
// Create an array of primitive types only (int, long etc).
//----------------------------------------------------------------------------
HObject* __cdecl ArrayAlloc(int type, int cItems);
//----------------------------------------------------------------------------
// Create an array of objects.
//----------------------------------------------------------------------------
HObject* __cdecl ClassArrayAlloc(int type, int cItems, char *szSig);
//----------------------------------------------------------------------------
// Copy an array ala System.arrayCopy()
//----------------------------------------------------------------------------
void __cdecl ArrayCopy(HObject *srch, long src_pos, HObject *dsth,
long dst_pos, long length);
//----------------------------------------------------------------------------
// Create and return a new array of bytes initialized from the C string.
//----------------------------------------------------------------------------
HArrayOfByte* __cdecl MakeByteString(char *str, long len);
//----------------------------------------------------------------------------
// Create and return a new Java String object, initialized from the C string.
//----------------------------------------------------------------------------
Hjava_lang_String* __cdecl makeJavaString(char *str, int len);
//----------------------------------------------------------------------------
// Get the characters of the String object into a C string buffer.
// No allocation occurs. Assumes that len is the size of the buffer.
// The C string's address is returned.
//----------------------------------------------------------------------------
char* __cdecl javaString2CString(Hjava_lang_String *s, char *buf, int buflen);
//----------------------------------------------------------------------------
// Return the length of the String object.
//----------------------------------------------------------------------------
int __cdecl javaStringLength(Hjava_lang_String *s);
//----------------------------------------------------------------------------
// Note: The int passed to these API's must be an object ptr.
//----------------------------------------------------------------------------
#define obj_monitor(handlep) ((int) handlep)
void __cdecl monitorEnter(unsigned int);
void __cdecl monitorExit(unsigned int);
void __cdecl monitorNotify(unsigned int);
void __cdecl monitorNotifyAll(unsigned int);
#define ObjectMonitorEnter(obj) monitorEnter((int)obj)
#define ObjectMonitorExit(obj) monitorExit((int)obj)
#define ObjectMonitorNotify(obj) monitorNotify((int)obj)
#define ObjectMonitorNotifyAll(obj) monitorNotifyAll((int)obj)
//----------------------------------------------------------------------------
// String helpers...
//----------------------------------------------------------------------------
int __cdecl jio_snprintf(char *str, size_t count, const char *fmt, ...);
int __cdecl jio_vsnprintf(char *str, size_t count, const char *fmt, va_list
args);
#ifdef __cplusplus
}
#endif
#endif